home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / admin / admin-v1.000 / admin-v1 / load < prev    next >
Text File  |  1995-05-20  |  2KB  |  53 lines

  1. #!/bin/sh
  2. #
  3. # load:    Display system load, with suggestions as to how appropriate a
  4. #        time it is to run a CPU-intensive process.
  5. #
  6.  
  7. echo
  8. echo "     SYSTEM LOAD ANALYSIS"
  9. echo
  10.  
  11. uptime | awk '{
  12.     val = $(NF - 2)
  13.  
  14.     if (substr(val, length(val), length(val)) == ",")
  15.         val = substr(val, 1, length(val)-1)
  16.  
  17.     printf "The current system load is %s\n\n", val
  18.  
  19.     if (val < 1) {
  20.         print "This is a very light system load."
  21.         print "It is a good time to run a report."
  22.     }
  23.     else if (val < 1.5) {
  24.         print "This is a relatively light system load. It is OK to run"
  25.         print "a report now."
  26.     } else if (val < 2) {
  27.         print "This is a moderate system load. Long reports will slow"
  28.         print "the system down a bit, but go ahead if you must."
  29.         print "Better yet, for low-priority reports, wait until the"
  30.         print "system load drops below 1.00."
  31.     } else if (val < 3) {
  32.         print "This is a medium-to-heavy load. Please do not run long reports"
  33.         print "unless you really have to. They WILL slow the system down somewhat."
  34.     } else if (val < 4) {
  35.         print "This is a heavy load. Please do not run reports unless they are"
  36.         print "very urgent."
  37.     } else if (val < 5) {
  38.         print "This is an EXTREMELY HEAVY system load. Please defer running any"
  39.         print "reports at least until the load drops down under 3.00,"
  40.         print "preferably under 2.00. Thank you."
  41.     }
  42.     else if (val < 7) {
  43.         print "At this rate, the CPU may soon have a meltdown..."
  44.         print "Please, PLEASE do NOT run any reports until the load"
  45.         print "settles down below 3.00 !! THANK YOU!"
  46.     }
  47.     else {
  48.         print "This is a ridiculously heavy load; there may be"
  49.         print "something wrong with the system. Please contact a Tech"
  50.         print "person immediately, and, of course, do not run any reports."
  51.     } 
  52. }'
  53.